package org.nvframe.component.state;

import org.newdawn.slick.geom.Vector2f;
import org.nvframe.component.AbstractComponent;
import org.nvframe.entity.Entity;

public abstract class AbstractPosition extends AbstractComponent implements Position {
	
	@Override
	public abstract Vector2f getXY();

	@Override
	public abstract void setXY(Vector2f xy);

	@Override
	public abstract float getDirection();

	@Override
	public abstract void setDirection(float direction);
	
	protected Vector2f position;
	protected float direction;

	protected float scale;
	protected float height;
	protected float width;
	
	public AbstractPosition(String id, Entity owner) {
		super(id, owner);
	}
	
	public void setXY(float x, float y) {
		setXY(new Vector2f(x, y));
	}
	
	public float getX() {
		return getXY().x;
	}
	
	public float getY() {
		return getXY().y;
	}
	
	public void setX(float x) {
		setXY(x, getY());
	}
	
	public void setY(float y) {
		setXY(getX(), y);
	}

	public float getScale() {
		return scale;
	}

	public void setScale(float scale) {
		this.scale = scale;
	}

	public float getHeight() {
		return height;
	}

	public void setHeight(float height) {
		this.height = height;
	}

	public float getWidth() {
		return width;
	}

	public void setWidth(float width) {
		this.width = width;
	}
	
	@Override
	public String toString() {
		return "x: " + getX() + ", y: " + getY() + ", direction:" + getDirection();
	}
}
